#ifndef CPLAYLIST_H
#define CPLAYLIST_H

#include <QWidget>
#include <QListWidget>
#include <QLabel>
#include <QPushButton>
#include <unordered_set>
using namespace std;

class CPlayList : public QWidget
{
    Q_OBJECT
public:
    explicit CPlayList(QWidget *parent = nullptr);
    void updateCurrentPlayingItem(int idx);
    void showlist(QString videoFolder);
    unordered_set<QString> * getList(){   return _list;   }

    int getIndex(QListWidgetItem *item);
private:
    void initPlaylist();
    void mousePressEvent(QMouseEvent* event) override;

signals:
    void closelist();
    void playlist(QListWidgetItem *item);

private:
    //播放列表
    QListWidget *_playlistwidget;
    QLabel * _ptitleTextLabel;
    QPushButton * _pcloseButton;
    //QString _videoFolder; // 播放文件夹

    unordered_set<QString> *_list;
    int _oldIdx = -1;

};

#endif // CPLAYLIST_H
